package cn.edu.njust.control;

import cn.edu.njust.service.impl.reServiceImpl;
import cn.edu.njust.service.reService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/shenpi/*")
public class ShenpiController extends BaseServlet{
    reService re = new reServiceImpl();

    /**
     *  删除用户
     * @param request
     * @param response
     * @throws ServletException
     * @throws IOException
     */
    public void approveById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String idNo = request.getParameter("id");

        System.out.println(idNo);
        re.approveById(idNo);    //调用方法

        //响应成功的标识
        response.getWriter().write("success");
    }

    /**
     * 审批不通过
     * @param request
     * @param response
     * @throws ServletException
     * @throws IOException
     */
    public void disapproveById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String idNo = request.getParameter("id");

        System.out.println(idNo);
        re.disapproveById(idNo);    //调用方法


        //响应成功的标识
        response.getWriter().write("success");
    }
}
